package com.lainiao.cookie;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 *  在服务器，Cookie的创建和发送
 */
@WebServlet("/cc")
public class cookie01_CookieCreate extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 创建Cookie
        Cookie cookie = new Cookie("name","梁非凡");
        // 响应Cookie
        response.addCookie(cookie);
    }
}
